package com.ms.service.module.baccarat.dm;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ms.game.gmtool.IDoormanActionToGMTool;
import com.ms.game.lobby.message.CLobbyHallMachinedataRequest;
import com.ms.game.lobby.message.LobbyDebugCmdToModuleRequest;
import com.ms.game.mgdh.message.SDoorManCancelOfflineKeepDataRequest;
import com.ms.game.slot.base.ISlotDoormanAction;
import com.ms.game.slot.base.message.SGmtoolCleanDoormanSeatStatusRequest;
import com.ms.game.slot.base.message.SlotBasicDMMessageRequest;
import com.ms.game.slot.base.message.SlotBasicGameMessageRequest;
import com.ms.service.module.account.message.SSessionCloseNotify;
import com.ms.service.module.datacenterlite.message.SDCLiteNotifySeatStatChangeRequest;
import com.xpec.c4.game.datamanager.BaseDataInfo;
import com.xpec.c4.game.utility.GUID;
import com.xpec.c4.message.MessageTypes;
import com.xpec.c4.service.annotations.MessageType;
import com.xpec.c4.service.common.BaseMessageAction;

public class BacrDmAction extends BaseMessageAction implements ISlotDoormanAction, IDoormanActionToGMTool {
	@SuppressWarnings("unused")
	private static final Log log = LogFactory.getLog(BacrDmAction.class);

	@MessageType(typeCode = MessageTypes.S_SESSION_CLOSE_NOTIFY)
	public void revDisConnect(SSessionCloseNotify request) {
		this.getProcesser().revDisConnect(request);
	}

	@Override
	@MessageType(typeCode = MessageTypes.S_GMTOOL_CLEAN_DOORMAN_SEAT_STATUS)
	public int revGmtoolCleanDoorManSeatStatus(SGmtoolCleanDoormanSeatStatusRequest request) {
		return getProcesser().revGmtoolCleanDoorManSeatStatus(request);
	}

	@Override
	@MessageType(typeCode = MessageTypes.S_LOBBY_DM_HALL_MACHINEDATA_REQUEST)
	public void revLobbyHallMachineList(CLobbyHallMachinedataRequest request) {
		getProcesser().revLobbyHallMachineList(request);
	}

	public BacrDmProcessor getProcesser() {
		return ((BacrDmProcessor) this.getModule().getBasicprocesser());
	}

	@Override
	public void revLobbyDebugCommand(SlotBasicDMMessageRequest request) throws ClassNotFoundException {
		getProcesser().revLobbyDebugCommand((LobbyDebugCmdToModuleRequest) request);
	}

	@MessageType(typeCode = MessageTypes.S_BACR_DOORMAN_ASYNC_HISTORYDATA)
	public void revAysncHistoryData(SlotBasicDMMessageRequest request) {
		getProcesser().revAysncHistoryData(request);
	}

	// ----------------↓新框架己不使用以下函式↓----------------

	@Override
	@MessageType(typeCode = MessageTypes.C_SLOT_COMMON_DM_SEAT_PLAYER_INFO_REQUEST)
	public void revSeatPlayerInfoRequest(SlotBasicDMMessageRequest request) {
		getProcesser().revSeatPlayerInfoRequest(request);
	}

	@Override
	@MessageType(typeCode = MessageTypes.S_GMTOOL_ONLINE_NUMBER_REQUEST)
	public ArrayList<GUID> getHallUserNumber(Object request) {
		return getProcesser().getHallUserNumber();
	}

	@Override
	@MessageType(typeCode = MessageTypes.S_DOORMAN_CANCEL_OFFLINEKEEPDATA)
	public void revLobbyCancelOfflineKeepData(SDoorManCancelOfflineKeepDataRequest reuqest) {
	}

	@Override
	public void cancelPlayerKeepData(GUID player) {
		getProcesser().cancelPlayerKeepData(player);
	}

	@Override
	public void revDCLiteNotifyKeepDataEmpty(SDCLiteNotifySeatStatChangeRequest request) {

	}

	@Override
	public void revDoSeatMachine(SlotBasicDMMessageRequest request) throws ClassNotFoundException {

	}

	@Override
	public void revDoSeatCheckCurrentData(SlotBasicGameMessageRequest request) {

	}

	@Override
	public void kickPlayerSeat(GUID player) {

	}

	@Override
	public void revSeatVerifyTimeOutNotify(SlotBasicDMMessageRequest request) {

	}

	@Override
	public void revSeatStatChange(SlotBasicGameMessageRequest request) {

	}

	@Override
	public void revMachineDataList(SlotBasicDMMessageRequest request) {
		getProcesser().revMachineDataList(request);
	}

	@Override
	public void onPlayerDataAgentBack(BaseDataInfo obj, Object... userObject) {
		try {
			getProcesser().onPlayerDataAgentBack(obj, userObject);
		} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
				| InvocationTargetException | ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
